package com.hqd.ch03.v27.jdbc.support;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public abstract class JdbcUtils {

    public static void closeConnection(Connection con) {
        if (con != null) {
            try {
                con.close();
            } catch (Throwable ex) {
                ex.printStackTrace();
            }
        }
    }

    public static void closeStatement(Statement stmt) {
        if (stmt != null) {
            try {
                stmt.close();
            } catch (SQLException ex) {
                ex.printStackTrace();
            }
        }
    }

    public static void closeResultSet(ResultSet rs) {
        if (rs != null) {
            try {
                rs.close();
            } catch (Throwable ex) {
                ex.printStackTrace();
            }
        }
    }

}
